<?php

/**
 * Brokerage form.
 *
 * @package    Moncada
 * @subpackage form
 * @author     Federico Motta - Andrea Burza
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class BrokerageForm extends BaseBrokerageForm
{
  public function configure()
  {
	$this->useFields(array('nome', 'anno','lunghezza','prezzo', 'tipo_id', 
							'immagine1','immagine2','immagine3',
							'immagine4','immagine5','immagine6',
							'pdf'
							));
	$this->widgetSchema['tipo_id'] = new sfWidgetFormChoice(array(
		  'choices'  => Doctrine_Core::getTable('Tipo')->getList(),
		  'expanded' => false,
		));
			for($i=1;$i<=6;$i++){
		$this->widgetSchema["immagine$i"] = new sfWidgetFormInputFile(array(
		  'label' => "Carica Immagine - $i:"
		));
		$this->validatorSchema["immagine$i"] = new sfValidatorFile(array(
		  'required'   => false,
		  'path'       => sfConfig::get('sf_upload_dir').'/navi',
		  'mime_types' => 'web_images',
		));
		}	
		$this->widgetSchema['pdf'] = new sfWidgetFormInputFile(array(
		  'label' => "Carica pdf:"
		));
		$this->validatorSchema['pdf'] = new fegxValidatorFile(array(
		  'required'   => false,
		  'path'       => sfConfig::get('sf_upload_dir').'/pdf', 
		  'mime_types' => 'upload_files',
		  ));

		$this->embedI18n(array('it', 'en'));
		$this->widgetSchema->setLabel('en', 'English');
		$this->widgetSchema->setLabel('it', 'Italiano');
  }
}
